package com.juyu.miliao.scheduler.dao.redis;

import com.juyu.miliao.common.constant.BillBeansGameKey;
import com.juyu.miliao.common.constant.CallTimeRankingListKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.concurrent.TimeUnit;

/**
 * 当天寻寻三国个人赢取存储
 * @Auther: 卜加超
 * @Date: 2019/8/6 16:30
 * @Description:
 */
@Repository
public class BeansGameRedisDao {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public void setSanGuoGameWinBeans(LocalDate now,Long userId,Long beans){
        String key = BillBeansGameKey.getSanGuoGameWinBeansKey(now,userId);
        stringRedisTemplate.opsForValue().increment(key,beans);
        stringRedisTemplate.expire(key,1, TimeUnit.DAYS);
    }
}
